using System;
using System.Collections.Generic;
using System.Text;

namespace RapidHDL
{
    public class ClockSink : ClockComponent 
    {
        //private NodeState nsLastNodeState;

        public ClockSink(Component poParentComponent, string psName)
            : base(poParentComponent, psName)
        {
        }

        public override void CalculateOutput()
        {
            Node nClockIn;
            Node nClockOut;
            nClockIn = (Node)ClockIn[0];

            if (nClockIn.NodeState != NodeState.Undefined && nClockIn.NodeState != NodeState.Undefined)
            {
                nClockOut = (Node)ClockOut.Nodes[0];
                if (nClockOut.NodeState != nClockIn.NodeState)
                    ToggleClock();
            }
        }

    }
}
